//
//  Model_myList.m
//  KWNLaywerClient
//
//  Created by 张明磊 on 14/11/9.
//  Copyright (c) 2014年 张明磊. All rights reserved.
//

#import "Model_myList.h"

@implementation Model_myList


- (void)getSelfWithDic:(NSDictionary *)dic
{
    NSString *string_id = [dic objectForKey:@"id"];
    NSString *string_solve = [dic objectForKey:@"is_solve"];
    NSString *string_unread = [dic objectForKey:@"lawyunread"];
    NSString *string_text = [dic objectForKey:@"question"];
    NSString *string_area = [dic objectForKey:@"question_area"];
    NSString *string_type = [dic objectForKey:@"question_type"];
    NSString *string_time = [dic objectForKey:@"time"];
    
    if(string_id && ![string_id isKindOfClass:[NSNull class]]){
        self.string_id = string_id;
    }
    if(string_solve && ![string_solve isKindOfClass:[NSNull class]]){
        self.string_isSolve = string_solve;
    }
    if(string_unread && ![string_unread isKindOfClass:[NSNull class]]){
        self.string_unRead = string_unread;
    }
    if(string_text && ![string_text isKindOfClass:[NSNull class]]){
        self.string_content = string_text;
    }
    if(string_area && ![string_area isKindOfClass:[NSNull class]]){
        self.string_area = string_area;
    }
    if(string_type && ![string_type isKindOfClass:[NSNull class]]){
        self.string_kind = string_type;
    }
    if(string_time && ![string_time isKindOfClass:[NSNull class]]){
        self.string_time = string_time;
    }
    
    //计算高度
    CGFloat height = 10 + 20 + 10 + 10 + 15 + 10;
    CGFloat textHeight = [UIUtils heightFor:string_text withFont:FontOfQuestionList labWidth:MainScreenWidth - 20];
    if (textHeight > 40) {
        textHeight = 40;
    }
    else
    {
        textHeight = 20;
    }
    
    height = height + textHeight;
    self.myList_height = height;
}

@end
